package org.wu.framework.authorization.platform.application.assembler;


import org.wu.framework.authorization.platform.application.command.SysDictionaryDataCommand;
import org.wu.framework.authorization.platform.application.dto.SysDictionaryDataDTO;
import org.wu.framework.authorization.platform.domain.model.sys.dictionary.data.SysDictionaryData;
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyAssembler;

/**
 * describe
 *
 * @author Jia wei Wu
 * @date 2023/05/17 11:19 晚上
 * @see DefaultDDDLazyAssembler
 **/

public class SysDictionaryDataDTOAssembler {


    /**
     * describe 应用层入参转换成 持久层入参
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/
    public static SysDictionaryData toDictionaryData(SysDictionaryDataCommand sysDictionaryDataCommand) {
        if (null != sysDictionaryDataCommand) {
            SysDictionaryData sysDictionaryData = new SysDictionaryData();
            sysDictionaryData.setCode(sysDictionaryDataCommand.getCode());
            sysDictionaryData.setCreateTime(sysDictionaryDataCommand.getCreateTime());
            sysDictionaryData.setDescription(sysDictionaryDataCommand.getDescription());
            sysDictionaryData.setDictionaryCode(sysDictionaryDataCommand.getDictionaryCode());
            sysDictionaryData.setId(sysDictionaryDataCommand.getId());
            sysDictionaryData.setName(sysDictionaryDataCommand.getName());
            sysDictionaryData.setPcode(sysDictionaryDataCommand.getPcode());
            sysDictionaryData.setSortValue(sysDictionaryDataCommand.getSortValue());
            sysDictionaryData.setUpdateTime(sysDictionaryDataCommand.getUpdateTime());
            return sysDictionaryData;
        }
        return null;
    }

    /**
     * describe 持久层领域对象转换成DTO对象
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/
    public static SysDictionaryDataDTO fromDictionaryData(SysDictionaryData sysDictionaryData) {
        if (null != sysDictionaryData) {
            SysDictionaryDataDTO sysDictionaryDataDTO = new SysDictionaryDataDTO();
            sysDictionaryDataDTO.setCode(sysDictionaryData.getCode());
            sysDictionaryDataDTO.setCreateTime(sysDictionaryData.getCreateTime());
            sysDictionaryDataDTO.setDescription(sysDictionaryData.getDescription());
            sysDictionaryDataDTO.setDictionaryCode(sysDictionaryData.getDictionaryCode());
            sysDictionaryDataDTO.setId(sysDictionaryData.getId());
            sysDictionaryDataDTO.setName(sysDictionaryData.getName());
            sysDictionaryDataDTO.setPcode(sysDictionaryData.getPcode());
            sysDictionaryDataDTO.setSortValue(sysDictionaryData.getSortValue());
            sysDictionaryDataDTO.setUpdateTime(sysDictionaryData.getUpdateTime());
            return sysDictionaryDataDTO;
        }
        return null;
    }

}